<?php
declare(strict_types=1);

namespace LowCode\Naive;

use LowCode\Naive;
use LowCode\Traits\Props\HasAffix;

/**
 * 组件 - 侧边导航 AnchorLink
 * @method static static make(string $title = null, string $href = "", array $children = []) AnchorLink组件
 */
class AnchorLink extends Naive
{
    use HasAffix;

    /**
     * @param string|null $title
     * @param string $href
     * @param array $children
     */
    public function __construct(string $title = null, string $href = "", array $children = [])
    {
        parent::__construct();
        $this->title($title);
        $this->href($href);
        $this->children($children);
    }

    /**
     * 设置标题
     * @param string $title
     * @return $this
     */
    public function title(string $title): AnchorLink
    {
        return $this->prop('title', $title);
    }

    /**
     * 设置跳转ID锚点
     * @param string $href
     * @return $this
     */
    public function href(string $href): AnchorLink
    {
        return $this->prop('href', $href);
    }

}
